/* * Copyright the original author or authors. *  * Licensed under the MOZILLA PUBLIC LICENSE, Version 1.1 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at *  *	  http://www.mozilla.org/MPL/MPL-1.1.html *  * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.googlecode.milib.util {
	import flash.net.LocalConnection;	import flash.utils.Dictionary;	/**
	 * @author Marek Brun
	 */
	public class MilibUtil {				public static const objectForObject:Dictionary=new Dictionary(true);				/**		 * Warning: use only for testing purposes (not in final version)		 */		public static function forceGarbageCollector():void {			try {			   new LocalConnection().connect('foo');			   new LocalConnection().connect('foo');			} catch (e:*) {
			}		}
		
		public static function getDynamicObjectForObject(obj:Object):Object {			if(!objectForObject[obj]){				objectForObject[obj]={};			} 			return objectForObject[obj];
		}				public static function callMethod(method:Function, args:Array):void {			switch(args.length){				case 0:					method();				break;				case 1:					method(args[0]);				break;				case 2:					method(args[0], args[1]);				break;				case 3:					method(args[0], args[1], args[2]);				break;				case 4:					method(args[0], args[1], args[2], args[3]);				break;				case 5:					method(args[0], args[1], args[2], args[3], args[4]);				break;				case 6:					method(args[0], args[1], args[2], args[3], args[4], args[5]);				break;				default:					throw new Error('Unsupported number of arguments ('+args.length+')');			}		}			}}